<template>
  <van-nav-bar title="物流详情" left-arrow @click-left="onBack" />

  <van-steps direction="vertical" :active="0" v-if="expressList.length != 0">
    <van-step v-for="item in expressList" :key="item.id">
      <h3>{{ item.status }}</h3>
      <p>{{ item.time }}</p>
    </van-step>
  </van-steps>
  <van-empty v-else description="物流信息正在更新中，请稍后查询......" />
</template>

<script>
export default {
  data() {
    return {
      expressList: [],
    };
  },
  created() {
    this.getExpressData();
  },
  methods: {
    onBack() {
      this.$router.go(-1);
    },
    async getExpressData() {
      let result = await this.$api.OrderExpress();
      if (result.msg === "ok") {
        this.expressList = result.result.list;
      }

      // console.log(this.expressList);
    },
  },
};
</script>